﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoreMVVM.ViewModels;
using System.ComponentModel;

namespace GeometryViz3D.ViewModels
{
    public class ModelEditorViewModel : ViewModelBase
    {
        IMainViewModel m_mainVM;

        public ModelEditorViewModel(IMainViewModel mainVM)
        {
            m_mainVM = mainVM;
            m_mainVM.PropertyChanged += new PropertyChangedEventHandler(m_mainVM_PropertyChanged);
        }

        void m_mainVM_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
                case "Model":
                    OnPropertyChanged("AllPoints");
                    OnPropertyChanged("AllLines");
                    OnPropertyChanged("AllPlanes");
                    break;

                case "AllPoints":
                    OnPropertyChanged("AllPoints");
                    break;

                case "AllLines":
                    OnPropertyChanged("AllLines");
                    break;

                case "AllPlanes":
                    OnPropertyChanged("AllPlanes");
                    break;
            }
        }

        public ElementCollection<PointViewModel> AllPoints
        {
            get 
            { 
                return m_mainVM.AllPoints; 
            }
        }

        public ElementCollection<LineViewModel> AllLines
        {
            get 
            { 
                return m_mainVM.AllLines; 
            }
        }

        public ElementCollection<PlaneViewModel> AllPlanes
        {
            get 
            { 
                return m_mainVM.AllPlanes; 
            }
        }
    }
}
